
export const getUrlParam = function(key: string, byHash = false){
  const reg = new RegExp('(^|&)' + key + '=([^&]*)(&|$)', 'i');
  const r = byHash ? (window.location.hash.split('?')[1]).match(reg) : window.location.search.substr(1).match(reg);
  if(r !== null) return decodeURI(r[2]);
  return null;
};

export const isMobile = function(): boolean {
  const userAgent: any = navigator.userAgent;
  const agents: string[] = ["Android", "iPhone", "SymbianOS", "Windows Phone", "iPod", "iPad"];
  return agents.some((item: string) => userAgent.indexOf(item) > -1);
};